package com.weblog.home.client;

import com.weblog.home.client.impl.ArticleSearchClientImpl;
import com.weblog.home.interceptor.FeignInterceptor;
import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2019/10/317:54
 */
@FeignClient(value = "weblog-search",fallback = ArticleSearchClientImpl.class,configuration = FeignInterceptor.class)
public interface ArticleSearchClient {


    @PostMapping("article/client/stats")
    Result fetchTotalByCategory(@RequestParam int level, @RequestBody List<String> cidList);

    /**
     * 查询总记录数
     * @return
     */
    @GetMapping("article/client/sum")
    Result getSum();

    /**
     * 查询热门文章前20
     * @return
     */
    @PostMapping("article/client/hot20")
    Result fetchHotArticle();
}
